//
// Created by zing on 3/28/2020.
//

#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char *argv[]) {
    int fd;
    fd = open("test.txt", O_RDWR);
    if (fd < 0) {
        printf("open file error:%s;errno:%d", strerror(errno), fd);
        return EXIT_FAILURE;
    }
    char *str = "hello world,hello c";
    ssize_t i = write(fd, str, strlen(str) + 1);
    if (i < 0){
        printf("write file error:%s;errno:%d", strerror(errno), fd);
        return EXIT_FAILURE;
    }
    return EXIT_SUCCESS;
}
